﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.master" AutoEventWireup="true"
    CodeFile="QLMuaThe.aspx.cs" Inherits="Admin_TheHoiVien_QLMuaThe" %>

<%@ Register Assembly="PagerControl" Namespace="CutePager" TagPrefix="cc1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="HomePlaceHolder" runat="Server">
    <div class="hrm_header_placeholder">
        Quản Lý Mua Thẻ Hội Viên</div>
    <div style="padding: 10px">
        <asp:HiddenField ID="H_CatalogId" Value="0" runat="server" />
        <asp:Panel ID="PanelAdd" Width="100%" GroupingText="Cập nhật thông tin" runat="server">
            <table border="0" width="100%" cellpadding="0" cellspacing="0">
                <tr>
                    <td colspan="8" height="10">
                    </td>
                </tr>
                <tr>
                    <td width="20">
                    </td>
                    <td width="110" class="hrm_title_blue">
                    </td>
                    <td width="7" class="hrm_title_blue">
                    </td>
                    <td>
                        <asp:Label ID="lblStatus" ForeColor="Red" runat="server" Text=""></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td colspan="8" height="4">
                    </td>
                </tr>
                <tr>
                    <td width="20">
                    </td>
                    <td width="110" class="hrm_title_blue">
                        Mã Thẻ
                    </td>
                    <td width="7" class="hrm_title_blue">
                        :
                    </td>
                    <td>
                        <asp:TextBox ID="txtMaThe" CssClass="hrm_textbox" Width="200px" AutoPostBack="true"
                            OnTextChanged="MaThe_Changed" Text="N/A" MaxLength="16" runat="server"></asp:TextBox>
                        <span style="font-size: 7pt; font-style: italic; color: Green; font-weight: bold">16
                            ký tự số</span>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" SetFocusOnError="True"
                            ControlToValidate="txtMaThe" Display="Dynamic" ErrorMessage=" (*)"></asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="Chỉ chấp nhận kiểu số"
                            Display="Dynamic" ValidationExpression="\d+" ControlToValidate="txtMaThe"></asp:RegularExpressionValidator>
                        <br />
                        <font color="red">
                            <asp:Label ID="lblMaThe" runat="server"></asp:Label></font>
                    </td>
                    <td width="20">
                    </td>
                    <td width="110" class="hrm_title_blue">
                        Họ tên Khách Hàng
                    </td>
                    <td width="7" class="hrm_title_blue">
                        :
                    </td>
                    <td>
                        <asp:TextBox ID="txtHoTen" CssClass="hrm_textbox" Width="400px" MaxLength="100" runat="server"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" SetFocusOnError="True"
                            ControlToValidate="txtHoTen" Display="Dynamic" ErrorMessage=" (*)"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td colspan="8" height="4">
                    </td>
                </tr>
                <tr>
                    <td width="20">
                    </td>
                    <td width="110" class="hrm_title_blue">
                        Ngày sinh
                    </td>
                    <td width="7" class="hrm_title_blue">
                        :
                    </td>
                    <td>
                        <asp:TextBox ID="txtNgaySinh" runat="server" CssClass="hrm_textbox" Width="150px"
                            MaxLength="10" Style="text-align: justify" /><span style="font-size: 7pt; font-style: italic;
                                color: Green; font-weight: bold">Theo chuẩn "dd/MM/yyyy"</span>
                        <cc2:CalendarExtender ID="CalendarExtender1" TargetControlID="txtNgaySinh" Format="dd/MM/yyyy"
                            runat="server">
                        </cc2:CalendarExtender>
                        <br />
                        <font color="red">
                            <asp:Label ID="lblNgaySinh" runat="server"></asp:Label></font>
                    </td>
                    <td width="20">
                    </td>
                    <td width="110" class="hrm_title_blue">
                        Hộp thư
                    </td>
                    <td width="7" class="hrm_title_blue">
                        :
                    </td>
                    <td>
                        <asp:TextBox ID="txtEmail" CssClass="hrm_textbox" Width="400px" MaxLength="200" runat="server"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" SetFocusOnError="True"
                            ControlToValidate="txtEmail" Display="Dynamic" ErrorMessage=" (*)"></asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ID="regEmail" ControlToValidate="txtEmail" Text="(Invalid email)"
                            ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td colspan="8" height="4">
                    </td>
                </tr>
                <tr>
                    <td width="20">
                    </td>
                    <td width="110" class="hrm_title_blue">
                        Số Điện thoại
                    </td>
                    <td width="7" class="hrm_title_blue">
                        :
                    </td>
                    <td>
                        <asp:TextBox ID="txtPhone" CssClass="hrm_textbox" Width="200px" MaxLength="16" runat="server"></asp:TextBox>
                        <span style="font-size: 7pt; font-style: italic; color: Green; font-weight: bold">Kiểu
                            số</span>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" SetFocusOnError="True"
                            ControlToValidate="txtPhone" Display="Dynamic" ErrorMessage=" (*)"></asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ErrorMessage="Chỉ chấp nhận kiểu số"
                            Display="Dynamic" ValidationExpression="\d+" ControlToValidate="txtPhone"></asp:RegularExpressionValidator>
                    </td>
                    <td width="20">
                    </td>
                    <td width="110" class="hrm_title_blue">
                        Địa Chỉ
                    </td>
                    <td width="7" class="hrm_title_blue">
                        :
                    </td>
                    <td>
                        <asp:TextBox ID="txtAddress" CssClass="hrm_textbox" Width="400px" MaxLength="250"
                            runat="server"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" SetFocusOnError="True"
                            ControlToValidate="txtAddress" Display="Dynamic" ErrorMessage=" (*)"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td colspan="8" height="4">
                    </td>
                </tr>
                <tr>
                    <td width="20">
                    </td>
                    <td width="80" class="hrm_title_blue">
                        Loại thẻ
                    </td>
                    <td width="7" class="hrm_title_blue">
                        :
                    </td>
                    <td width="400">
                        <asp:DropDownList ID="cboLoaiThe" CssClass="hrm_combobox" Width="205px" runat="server">
                        </asp:DropDownList>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" SetFocusOnError="True"
                            InitialValue="0" ControlToValidate="cboLoaiThe" Display="Dynamic" ErrorMessage=" (*)"></asp:RequiredFieldValidator>
                    </td>
                    <td width="20">
                    </td>
                    <td width="110" class="hrm_title_blue">
                        Xác nhận?
                    </td>
                    <td width="7" class="hrm_title_blue">
                        :
                    </td>
                    <td>
                        <asp:CheckBox ID="chkSuDung" Checked="true" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td colspan="8" height="4">
                    </td>
                </tr>
                <tr>
                    <td width="20">
                    </td>
                    <td width="80" class="hrm_title_blue">
                        Ngày đăng ký mua thẻ
                    </td>
                    <td width="7" class="hrm_title_blue">
                        :
                    </td>
                    <td width="400">
                        <asp:TextBox runat="server" ValidationGroup="vgMuathe" ID="tbNgayDangky" placeholder="Ngày đăng ký mua thẻ"></asp:TextBox>
                        <cc2:CalendarExtender ID="CalendarExtender2" TargetControlID="tbNgayDangky" Format="dd/MM/yyyy"
                            runat="server" Animated="True">
                        </cc2:CalendarExtender>
                        <asp:Label runat="server" ID="lbNgaydangky"></asp:Label>
                    </td>                    
                    <td width="20">
                    </td>
                    <td width="110" class="hrm_title_blue">
                        Số CMND
                    </td>
                    <td width="7" class="hrm_title_blue">
                        :
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="tbSocmnd" ValidationGroup="vgMuathe"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td colspan="8" height="4">
                    </td>
                </tr>
                <tr>
                    <td width="20">
                    </td>
                    <td width="110" class="hrm_title_blue">
                    </td>
                    <td width="7" class="hrm_title_blue">
                    </td>
                    <td>
                        <asp:ImageButton ID="cmdSave" ImageUrl="~/Images/save.jpg" runat="server" OnClick="cmdSave_Click" />
                        <asp:ImageButton ID="cmdReset" CausesValidation="false" ImageUrl="~/Images/huy.jpg"
                            runat="server" OnClick="cmdReset_Click" />
                    </td>
                </tr>
                <tr>
                    <td colspan="8" height="8">
                    </td>
                </tr>
            </table>
        </asp:Panel>
        <asp:Panel ID="PanelList" Width="100%" Height="355" GroupingText="Danh sách" runat="server">
            <table border="0" width="100%" cellpadding="0" cellspacing="0">
                <tr>
                    <td width="20">
                    </td>
                    <td style="padding-right: 15px">
                        <asp:Panel ID="PanelGrid" Width="100%" runat="server">
                            <br />
                            <asp:GridView ID="gridCatalog" runat="server" DataKeyNames="Id" Width="100%" BackColor="White"
                                OnRowCommand="gridCatalog_RowCommand" OnRowDataBound="gridCatalog_RowDataBound"
                                OnRowDeleting="gridCatalog_RowDeleting" EmptyDataText="<br><center>Không tồn tại dữ liệu</center><br>"
                                BorderColor="#CCCCCC" AutoGenerateColumns="false" BorderStyle="Solid" BorderWidth="1px"
                                CellPadding="3">
                                <Columns>
                                    <asp:BoundField DataField="id" Visible="false" HeaderText="id"></asp:BoundField>
                                    <asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="7%">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="cmdSelect" runat="server" CssClass="command_button" CausesValidation="false"
                                                runat="server" CommandName="Select" CommandArgument='<%# Eval("id") %>'>Sửa</asp:LinkButton>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="7%">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="cmdDelete" runat="server" CssClass="command_button" CausesValidation="false"
                                                runat="server" CommandName="Delete" CommandArgument='<%# Eval("id") %>'>Xóa</asp:LinkButton>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="HoTen" ItemStyle-Width="20%" HeaderText="Họ tên Khách Hàng">
                                    </asp:BoundField>
                                    <asp:TemplateField HeaderText="Loại thẻ" ItemStyle-Width="120">
                                        <ItemTemplate>
                                            <asp:Label ID="lblLT" runat="server" Text='<%# GetLoaiThe(Eval("IdLoaiThe")) %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="Email" ItemStyle-Width="25%" HeaderText="Hộp Thư"></asp:BoundField>
                                    <asp:CheckBoxField DataField="TrangThai" ItemStyle-Width="12%" ItemStyle-HorizontalAlign="Center"
                                        HeaderText="Xác nhận?"></asp:CheckBoxField>
                                </Columns>
                                <RowStyle ForeColor="#000066" />
                                <SelectedRowStyle BackColor="#dedfdf" Font-Bold="True" ForeColor="Gray" />
                                <HeaderStyle BackColor="#006699" Font-Bold="True" HorizontalAlign="Left" ForeColor="White" />
                            </asp:GridView>
                        </asp:Panel>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" height="10">
                        <cc1:Pager ID="Pager1" runat="server" PreviousClause="" NextClause="" LastClause=""
                            FirstClause="" PageClause="Trang" OfClause="/" PageSize="10" OnCommand="Pager1_Command">
                        </cc1:Pager>
                    </td>
                </tr>
            </table>
        </asp:Panel>
    </div>
</asp:Content>
